﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using XLuSharpLibrary.DbAccess;
using BHair.Base;
using BHair.Business;
using System.Configuration;
using BHair.Report;
using BHair.kucunpandian;
using System.Threading;
//using BHair.kucunpandian;

namespace BHair
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
            bool createNew;
            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
                    DbConfig.DbConnection = constr;
                    DbConfig.DbType = DBType.SQLServer;
                    // Application.Run(new frmkcpdreprot());
                    Application.Run(new frmLogin());
                   // Application.Run(new frmqtck());
                    //Application.Run(new frmtizhongbianhua());
                }
                else
                {
                    MessageBox.Show("应用程序已经在运行中...");
                    System.Threading.Thread.Sleep(1000);

                    //  终止此进程并为基础操作系统提供指定的退出代码。
                    System.Environment.Exit(1);
                }
            }
        }
    }
}
